home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 28 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.9 KB

  1. Path: gidora.kralizec.net.au!root
  2. From: Ross McKay <rosko@zeta.org.au>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Hungarian notation
  5. Date: Mon, 01 Jan 1996 14:45:59 -0800
  6. Organization: Soft Technologies
  7. Message-ID: <30E86427.3623@zeta.org.au>
  8. References: <cmanDK7x13.5KM@netcom.com> <verec-2712952049000001@ppp30.micronet.fr> <30E39BC0.3BAE@zeta.org.au> <verec-2912950003390001@ppp05.micronet.fr> <30E55183.52FF@zeta.org.au> <4c44dh$771@mujibur.inmind.com> <4c477m$ou4@macaw.cyberport.com>
  9. NNTP-Posting-Host: dialup71.syd1.zeta.org.au
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0b3 (Win16; I)
  14.  
  15. Warren Young wrote:
  16. > mfinney@inmind.com wrote:
  17. > >In <30E55183.52FF@zeta.org.au>, Ross McKay <rosko@zeta.org.au> writes:
  18. > >We also treat #defines the same way as any other constant or function
  19. > >for the same reason.  There have been many cases where something
  20. > >like...
  21. > >   #define insufficientStorage "Insufficient storage"
  22. > >became something like...
  23. > >   w_char const insufficientStorage[] = L"Insufficient storage";
  24. > >which is only a change in the type information and not in the
  25. > >semantics of the name.
  26. > Sure the semantics change.  Try passing the latter to printf() and see
  27. > how broken the program gets.  Or strlen(), or strtou()...  Granted,
  28. > you're likely to be changing the string manipulation functions at the
  29. > same time, but this is one place where HN becomes useful: helping you
  30. > find the places where you missed a function call that needs changing.
  31.  
  32. This is "implementation specific"... effecting the above change going
  33. from ISO Zinc to Unicode Zinc (8-bit ZIL_ICHARs become Unicode ZIL_ICHARs)
  34. calls (from within a Zinc-derived class) to sprintf() et al would _not_
  35. be broken.
  36.  
  37. > >The use of upper case names to distinguish #define names is one
  38. > >of the worst pseudo-standards that have been fostered upon the
  39. > >programming community.  Right up there with Hungarian notation.
  40. > It's very useful with macros, because it tells the reader, "Hey!  The
  41. > arguments to this macro aren't type-safe and there may be
  42. > side-effects!"  With C++, though, I have a solution that both of us
  43. > might find acceptable: dump #defines for consts and inline functions.
  44.  
  45. Good point... anyone else have an opinion on this, because I rather favour
  46. the "treat 'em all the same" approach, however this is a clear situation
  47. where ALL_CAPS adds value. 
  48.  
  49. > = Warren --
  50.  
  51. -- 
  52. // --------------------------------------------------------------------- //
  53. // Ross McKay        | email: rosko@zeta.org.au | The opinions expressed //
  54. // Soft Technologies | snail: GPO Box 562,      | are my own, not those  //
  55. // Sydney, Australia |        Sydney 2001, Aus. | of my employers.       //
  56. // --------------------------------------------------------------------- //
  57. //  "Circumcision is no skin off my nose"  (grafitti seen in Ultimo)     //
  58. // --------------------------------------------------------------------- //
  59.